#include<stdlib.h>
#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>


char *gettime(char pp[]){


    time_t  tn = time(NULL);
    struct tm *tmp = localtime(&tn);
    strftime(pp,24,"%T",tmp);
    return pp;

}

int main(int argc,char **argv){

    FILE *fp;
    char pp[24];
    fp = fopen("/tmp/deamon","w");
     gettime(pp);
     for (size_t i = 0; i < 5; i++)
     {
        fprintf(fp,"%s\n",pp);
        fflush(fp);
        sleep(1);
     }
     close(fp);
     


   return 0;
}